import { useEffect } from 'react'
import type { TableColumnsType } from 'antd';
import { Finance3 } from '@/stores/Finance3';
import { useSnapshot } from 'valtio';
import WHeaders from '@/components/WHeaders';
import WTables from '@/components/WTables';
export default function StoreSalesReport() {
  const finance=useSnapshot(Finance3)
  interface DataType {
    key: string;
    brand?: string;
    partition?: string;
    platform?: string;
    shop?: string;
    name: string;
    type: string;
    price: number;
    nums: number;
    sum: number;
    date: string;
    children?: DataType[];
  }
  const columns: TableColumnsType<DataType> = [
    {
      title: '品牌',
      dataIndex: 'brand',
      key: "1"
    },
    {
      title: '分区',
      dataIndex: 'partition',
      key: "2"
    },
    {
      title: '店铺',
      dataIndex: 'shop',
      key: "3"
    },
    {
      title: '平台',
      dataIndex: 'platform',
      key: "4"
    },
    {
      title: '商品名称',
      dataIndex: 'name',
      key: "5"
    },
    {
      title: '商品分类',
      dataIndex: 'type',
      key: "6"
    },
    {
      title: '单价',
      dataIndex: 'price',
      key: "7"
    },
    {
      title: '销量', dataIndex: 'nums',
      key: "8",
    },
    {
      title: '销售额',
      dataIndex: 'sum',
      key: "9"
    }
  ];
  useEffect(() => {
    finance.getList()
  },[]);
  return (
    <div>
      <WHeaders finance={Finance3}></WHeaders>
      <WTables columns={columns} data={finance.data} title={"销售收入明细"}></WTables>
    </div>
  )
}

